package com.DHH.Service.Base.Impl;
import com.DHH.Entity.Base.BaseMenu;
import com.DHH.Mapper.Base.BaseMenuMapper;
import com.DHH.Service.Base.IBaseMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BaseMenuServiceImpl implements IBaseMenuService{
	
	@Autowired
    private BaseMenuMapper baseMenuMapper;
    
   @Override
   public BaseMenu insertBaseMenu(BaseMenu baseMenu){
	   
        baseMenuMapper.insertSelective(baseMenu);
	   return baseMenu;
	   
   };
   @Override
   public BaseMenu updateBaseMenu(BaseMenu baseMenu){
	     baseMenuMapper.updateByPrimaryKeySelective(baseMenu);
        return baseMenu;
   };
   @Override
   public BaseMenu deleteBaseMenu(BaseMenu baseMenu){

	     baseMenuMapper.delete(baseMenu);
        return baseMenu;
   };
    /**
     * 保存或更新操作，返回值为主表
     */
    public BaseMenu saveOrUpdateBaseMenu(BaseMenu baseMenu){
        if(baseMenu.getId()==null)
        {
            baseMenuMapper.insertSelective(baseMenu);
        }else{
            baseMenuMapper.updateByPrimaryKeySelective(baseMenu);
        }
        return baseMenu;
    };
}
